package main

import "fmt"

func main() {

	//key 是string, value 是float32
	map1 := map[string]float32{"C": 5, "D": 5.5, "PYTHON": 6.6}
	fmt.Println(map1["C"])

	map1["tuanzhang"] = 8.8
	fmt.Println(map1["tuanzhang"])

	for s, f := range map1 {
		fmt.Printf("key=%s, value=%f \n", s, f)
	}

	//查看key是否存在
	f, ok := map1["tuanzhang"]
	if ok {
		fmt.Println("存在", f)
	} else {
		fmt.Println("不存在", f)
	}

	delete(map1, "tuanzhang")

	//查看key是否存在
	f1 := map1["tuanzhang"]
	fmt.Println(f1)
	fmt.Println("len=", len(map1))
}
